package offical.baseClass

/**
 * 接口的属性是抽象的
 * 属性可以有getter  setter ，但不允许有 幕后字段
 * 方法是抽象的，可以允许有默认方法实现
 */
interface MyInterface {

    val testAttr: String
        get() {
            return "test"
        }

    fun testFun() {
        println("default interface fun")
    }
}


interface Named {
    val name: String
}

interface Person : Named {
    val firstName: String
    val lastName: String

    //接口继承复写父接口属性
    override val name: String
        get() = "$firstName $lastName"
}

/**
 * 复写name属性可选
 */
data class Employee(override val firstName: String,
                    override val lastName: String) : Person


